SftPrintPreview/DLL 2.0

Help Integration

Softel vdm, Inc.

Providing access to online help when using SftPrintPreview/DLL in your applications is possible by handling one notification sent by the control to your application:

WM_NOTIFY / NM_SFTPRINTPREVIEW_HELP_CODE

The NM_SFTPRINTPREVIEW_HELP_CODE notification code is sent when the user requests online help.  The parent window of the Print Preview control receives the NM_SFTPRINTPREVIEW_HELP_CODE notification code through the WM_NOTIFY message.

The user can request online help by clicking on the Help button of the Page Setup dialog or by clicking on the Help button of the built-in tool bar.

This notification is not sent when the user hits F1 (or similar keys) as these are normally handled by the application, typically using a keyboard accelerator table (see Windows LoadAccelerators, TranslateAccelerator, etc.).

Example

C

LRESULT CALLBACK MainWindowProc(HWND hwndMain, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
    case WM_NOTIFY: {
        int id = (int) wParam; 
        LPNMHDR pnmh = (LPNMHDR) lParam;
        switch (id) {
        case IDC_PREVIEW:
            switch (pnmh->code) {
            case NM_SFTPRINTPREVIEW_HELP_CODE: { // help requested
                NM_SFTPRINTPREVIEW_HELP* pNtfy = (NM_SFTPRINTPREVIEW_HELP*) lParam;
                MessageBox(hwndMain, TEXT("Sorry, this sample application doesn't include online help."),
                   TEXT("SftPrintPreview/DLL"), MB_OK);
                break;
             }
            }
            break;
        }
        break;
     }
    }
    return DefWindowProc(hwndMain, uMsg, wParam, lParam);
}

C++

BEGIN_MESSAGE_MAP(CPreviewPagePrinting, CSftPrintPreview_View)
    ON_NM_SFTPRINTPREVIEW_HELP_CODE_REFLECT(OnNotifyHelpReflect)
END_MESSAGE_MAP()
afx_msg void CPreviewPagePrinting::OnNotifyHelpReflect(NMHDR * pNotifyStruct, LRESULT* lResult)
{
    MessageBox(_T("Sorry, this sample application doesn't include online help."), 
        _T("SftPrintPreview/DLL"), MB_OK);
    *lResult = 0;
}


Feedback / comments / error reports for this topic
© 2016 - Softel vdm, Inc. - www.softelvdm.com